<template>
  <div class="my-drawer" v-show="show">
    <div class="my-drawer-mask" @click="handeleMyDrawerClose"></div>
    <div class="my-drawer-tip">
      <h1>{{ headerSlot.props.title }}</h1>
      <Component
        :is="headerSlot.component"
        v-if="headerSlot && headerSlot.component"
        v-bind="headerSlot.props"
        v-on:click="headerSlot.listeners.success"
      />
    </div>
  </div>
</template>

<script>
export default {
  name: 'my-drawer',
  props: {
    showDrawer: Boolean,
    headerSlot: {
      type: Object,
      default: null,
    },
  },
  data() {
    return {
      show: false,
      movieForm: {
        nm: '',
        id: '',
        img: '',
        date: '',
        star: '',
      },
    }
  },
  methods: {
    handeleMyDrawerClose() {
      this.show = false
      this.$emit('closeMydrawer')
    },
  },
}
</script>

<style lang="scss" scoped>
.my-drawer {
  width: 100vw;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 10;

  .my-drawer-mask {
    width: 100%;
    height: 100%;
    background: #000;
    opacity: 0.6;
    position: absolute;
    left: 0;
    top: 0;
  }
  .my-drawer-tip {
    width: 60%;
    height: 100%;
    background: #fff;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 12;
  }
}
</style>
